// part1:C06:ex6.17.cpp
//if a str contains Upcase alpha.
#include <iostream>
#include <string>

bool has_upper(const std::string& str) {
  for (auto c : str) {
    if (isupper(c)) {
      return true;
    }
  }
  return false;
}

void to_lowerme(std::string& str) {
  for (auto &c : str) {
    c = tolower(c);
  }
}

int main(void) {
  using namespace std;
  string str;
  cout << "Enter a string:\n";
  cin >> str;
  if (has_upper(str)) {
    to_lowerme(str);
    cout << "after string is: " << str << endl;
  }
  else {
    cout << "No uppercase alpha!" << endl;
  }

  return 0;
}
